/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GerenteForm.java
 *
 * Created on 06/11/2009, 15:36:59
 */

package sigbar.view;

import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.border.TitledBorder;

/**
 *
 * @author hdhzero
 */
public class GerenteForm extends javax.swing.JPanel {

    private static String helptextRegistro = "Cadastre e Remova funcionarios do banco de dados.";
    private static String helptextBusca = "Procure por funcionarios em particular, buscando por varias informações.";
    private static String helptextHistorico = "Confira o fluxo de caixa da data que quizer.";

    private WorkerRegForm regForm;
    private WorkerSearchForm searchForm;
    private HistorySearchForm historyForm;

    /** Creates new form GerenteForm */
    public GerenteForm() {
        initComponents();
        init();
    }

    public void setHelpText(String string) {
        helpText.setText(string);
    }

    private void init() {
        regForm = new WorkerRegForm();
        searchForm = new WorkerSearchForm();
        historyForm = new HistorySearchForm();

        GridBagConstraints grid = new GridBagConstraints();
        grid.insets = new Insets(0, 0, 0, 0);
        grid.anchor = GridBagConstraints.NORTHWEST;
        grid.gridx = 0;
        grid.gridy = 0;
        grid.gridheight = 1;
        grid.gridwidth = 1;
        grid.fill = GridBagConstraints.BOTH;
        grid.weightx = 0;
        grid.weighty = 0;

        workPanel.add(regForm);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        graphPanel = new javax.swing.JPanel();
        regButton = new javax.swing.JButton();
        searchButton = new javax.swing.JButton();
        historyButton = new javax.swing.JButton();
        helpText = new javax.swing.JLabel();
        workPanel = new javax.swing.JPanel();

        graphPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Gráfico"));
        graphPanel.setPreferredSize(new java.awt.Dimension(300, 300));

        javax.swing.GroupLayout graphPanelLayout = new javax.swing.GroupLayout(graphPanel);
        graphPanel.setLayout(graphPanelLayout);
        graphPanelLayout.setHorizontalGroup(
            graphPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 288, Short.MAX_VALUE)
        );
        graphPanelLayout.setVerticalGroup(
            graphPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 273, Short.MAX_VALUE)
        );

        regButton.setText("Registro de funcionários");
        regButton.setPreferredSize(new java.awt.Dimension(150, 150));
        regButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                regButtonMouseEntered(evt);
            }
        });
        regButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                regButtonActionPerformed(evt);
            }
        });

        searchButton.setText("Procurar Funcionários");
        searchButton.setPreferredSize(new java.awt.Dimension(150, 150));
        searchButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                searchButtonMouseEntered(evt);
            }
        });
        searchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchButtonActionPerformed(evt);
            }
        });

        historyButton.setText("Visualizar Histórico");
        historyButton.setPreferredSize(new java.awt.Dimension(150, 150));
        historyButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                historyButtonMouseEntered(evt);
            }
        });
        historyButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                historyButtonActionPerformed(evt);
            }
        });

        helpText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        helpText.setText("Passe o mouse sobre um dos botões para saber sua função.");
        helpText.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        workPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Registro de Funcionários"));
        workPanel.setLayout(new java.awt.GridBagLayout());

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(workPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 804, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(regButton, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(searchButton, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(historyButton, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                                .addGap(6, 6, 6))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(helpText, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addComponent(graphPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {historyButton, regButton, searchButton});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(graphPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(regButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(searchButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(historyButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(helpText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(workPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void regButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_regButtonActionPerformed
        workPanel.remove(regForm);
        workPanel.remove(searchForm);
        workPanel.remove(historyForm);

        TitledBorder t = (TitledBorder) workPanel.getBorder();
        t.setTitle("Registro de Funcionários");
        workPanel.add(regForm);
        workPanel.repaint();
        workPanel.validate();
}//GEN-LAST:event_regButtonActionPerformed

    private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed
        workPanel.remove(regForm);
        workPanel.remove(searchForm);
        workPanel.remove(historyForm);

        TitledBorder t = (TitledBorder) workPanel.getBorder();
        t.setTitle("Busca de Funcionários");
        workPanel.add(searchForm);
        workPanel.repaint();
        workPanel.validate();
}//GEN-LAST:event_searchButtonActionPerformed

    private void historyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_historyButtonActionPerformed
        workPanel.remove(regForm);
        workPanel.remove(searchForm);
        workPanel.remove(historyForm);

        TitledBorder t = (TitledBorder) workPanel.getBorder();
        t.setTitle("Consulta de Históricos");
        workPanel.add(historyForm);
        workPanel.repaint();
        workPanel.validate();
}//GEN-LAST:event_historyButtonActionPerformed

    private void regButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_regButtonMouseEntered
        helpText.setText(helptextRegistro);
    }//GEN-LAST:event_regButtonMouseEntered

    private void searchButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_searchButtonMouseEntered
        helpText.setText(helptextBusca);
    }//GEN-LAST:event_searchButtonMouseEntered

    private void historyButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_historyButtonMouseEntered
        helpText.setText(helptextHistorico);
    }//GEN-LAST:event_historyButtonMouseEntered


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel graphPanel;
    private javax.swing.JLabel helpText;
    private javax.swing.JButton historyButton;
    private javax.swing.JButton regButton;
    private javax.swing.JButton searchButton;
    private javax.swing.JPanel workPanel;
    // End of variables declaration//GEN-END:variables

}
